<?php 

session_start();

if(!isset($_SESSION['session_usr'])){
	echo '<script>';
	echo "alert('Error: Ada tidak mempunyai akses ke halaman ini');";
	echo "window.location='login.php'";
	echo '</script>';
}else{

?>

<?php
require_once('lib/dbclass.php');
$db = new MySQL();


if (! $db->Query("select * from user")) $db->Kill(); 
?>

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Admin Panel</title>

    <!-- Bootstrap core CSS -->
    <link href="css/bootstrap.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="../style/style2.css" />

    <!-- Add custom CSS here -->
    <link href="css/sb-admin.css" rel="stylesheet">
    <link rel="stylesheet" href="font-awesome/css/font-awesome.min.css">
    <!-- Page Specific CSS -->
    <link rel="stylesheet" href="http://cdn.oesmith.co.uk/morris-0.4.3.min.css">

	<!-- TinyMCE -->
<script language="javascript" type="text/javascript" src="tinymcpuk-0.3/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
	tinyMCE.init({
		mode : "textareas",//exact or textareas
		theme : "advanced",//simple
		plugins : "youtube,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,flash,searchreplace,print,paste,directionality,fullscreen,noneditable,contextmenu",
		theme_advanced_buttons1_add_before : "",
		theme_advanced_buttons1_add : "fontsizeselect",
		theme_advanced_buttons2_add : "preview,forecolor",
		theme_advanced_buttons2_add_before: "pastetext,pasteword,emotions,print,",
		theme_advanced_buttons3_add_before : "tablecontrols",
		theme_advanced_buttons3_add : "fullscreen",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		plugin_insertdate_dateFormat : "%Y-%m-%d",
		plugin_insertdate_timeFormat : "%H:%M:%S",
		extended_valid_elements : "hr[class|width|size|noshade]",
		file_browser_callback : "fileBrowserCallBack",
		paste_use_dialog : false,
		theme_advanced_resizing : true,
		theme_advanced_resize_horizontal : false,
		theme_advanced_link_targets : "_something=My somthing;_something2=My somthing2;_something3=My somthing3;",
		media_strict : false,
		apply_source_formatting : true
	});

	function fileBrowserCallBack(field_name, url, type, win) {
		var connector = "../../filemanager/browser.html?Connector=connectors/php/connector.php";
		var enableAutoTypeSelection = true;
		
		var cType;
		tinymcpuk_field = field_name;
		tinymcpuk = win;
		
		switch (type) {
			case "image":
				cType = "Image";
				break;
			case "flash":
				cType = "Flash";
				break;
			case "file":
				cType = "File";
				break;
		}
		
		if (enableAutoTypeSelection && cType) {
			connector += "&Type=" + cType;
		}
		
		window.open(connector, "tinymcpuk", "modal,width=900,height=400");
	}
</script>
<!-- /TinyMCE -->
	
  </head>

  <body>

    <div id="wrapper">

      <!-- Sidebar -->
      <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="index.php">Admin Panel</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse navbar-ex1-collapse">
          <ul class="nav navbar-nav side-nav">
		  
            <li><a href="index.php"><i class="fa fa-dashboard"></i> Dashboard</a></li>
            <li><a href="index.php?q=1"><i class="fa fa-bar-chart-o"></i> Agenda</a></li>
            <li><a href="index.php?q=2"><i class="fa fa-table"></i> Artikel</a></li>
            <li><a href="index.php?q=3"><i class="fa fa-tag"></i> Berita</a></li>
            <li><a href="index.php?q=4"><i class="fa fa-book"></i> Divisi</a></li>
            <li><a href="index.php?q=5"><i class="fa fa-book"></i> Member</a></li>
            <li><a href="index.php?q=6"><i class="fa fa-book"></i> Pengurus</a></li>
			
			<?php while($rs = $db->RowArray()):?>
            <li><a href="index.php?q=7&id=<?php echo $rs['id_profil']?>"><i class="fa fa-user"></i> Profile</a></li>
			<?php endwhile;?>
			
            <li><a href="index.php?q=8"><i class="fa fa-video-camera"></i> Galeri</a></li>
          </ul>

          <ul class="nav navbar-nav navbar-right navbar-user">
            <li class="dropdown user-dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-user"></i> <?php echo $_SESSION['session_usr']?> <b class="caret"></b></a>
              <ul class="dropdown-menu">
                <li><a href="logout.php"><i class="fa fa-power-off"></i> Log Out</a></li>
              </ul>
            </li>
          </ul>
        </div><!-- /.navbar-collapse -->
      </nav>

      <div id="page-wrapper">

        <div class="row">
          <div class="col-lg-12">
			
			<?php
				
				if(isset($_GET['q'])){
					$q = $_GET['q'];
				
					if($q==1) include 'admin_agenda.php';
					elseif($q==2) include 'admin_artikel.php';
					elseif($q==3) include 'admin_berita.php';
					elseif($q==4) include 'admin_divisi.php';
					elseif($q==5) include 'admin_member.php';
					elseif($q==6) include 'admin_pengurus.php';
					elseif($q==7) include 'admin_profile.php';
					elseif($q==8) include 'admin_galeri.php';
					elseif($q==10) include '';
					elseif($q==11) include 'tambah_agenda.php';
					elseif($q==12) include 'edit_agenda.php';
					elseif($q==13) include 'tambah_artikel.php';
					elseif($q==14) include 'edit_artikel.php';
					elseif($q==15) include 'tambah_berita.php';
					elseif($q==16) include 'edit_berita.php';
					elseif($q==17) include 'tambah_divisi.php';
					elseif($q==18) include 'edit_divisi.php';
					elseif($q==19) include 'tambah_member.php';
					elseif($q==20) include 'edit_member.php';
					elseif($q==21) include 'tambah_pengurus.php';
					elseif($q==22) include 'edit_pengurus.php';
					elseif($q==23) include 'edit_buku_tamu.php';
					elseif($q==24) include 'tambah_galeri.php';
					elseif($q==25) include 'tambah_peta.php';
					elseif($q==26) include 'edit_peta.php';
					
					
				}else{
					include 'dashboard.php';
				}
				
			?>
           
        </div><!-- /.row -->

      </div><!-- /#page-wrapper -->

    </div><!-- /#wrapper -->

    <!-- JavaScript -->
    <script src="js/jquery-1.10.2.js"></script>
    <script src="js/bootstrap.js"></script>

    <!-- Page Specific Plugins -->
    <script src="http://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
    <script src="http://cdn.oesmith.co.uk/morris-0.4.3.min.js"></script>
    <script src="js/morris/chart-data-morris.js"></script>
    <script src="js/tablesorter/jquery.tablesorter.js"></script>
    <script src="js/tablesorter/tables.js"></script>

  </body>
</html>
<?php	
	
}

?>